//
//  ImageVC.m
//  BrushFace
//
//  Created by timer_q on 16/1/26.
//  Copyright © 2016年 Zzz. All rights reserved.
//

#import "ImageVC.h"

@interface ImageVC ()
{
    UIImageView *_imageView;
    NSArray *jieruArray;
    NSArray *jiechuArray;
    NSInteger _curIndex;
}
@end

@implementation ImageVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.navBar setNavBackColor:[UIColor clearColor]];
    [self.navBar setHideLeftBtn:YES];
    _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    [self.view addSubview:_imageView];
    jieruArray = @[@"2",@"3",@"4",@"5",@"6",@"7"];
    jiechuArray = @[@"2",@"3",@"4",@"5"];
    
    _imageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage)];
    [_imageView addGestureRecognizer:tap];
    _curIndex = 0;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    if (self.type == 0) {
        _imageView.image = [UIImage imageNamed:@"jieru1.PNG"];
    }else{
        _imageView.image = [UIImage imageNamed:@"jiechu1.PNG"];
    }
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}
- (void)tapImage{
    if (self.type==0) {
        if (_curIndex==jieruArray.count-1) {
            [self.navigationController popViewControllerAnimated:YES];
        }else{
            _imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"jieru%@.PNG",jieruArray[_curIndex+1]]];
        }
    }else{
        if (_curIndex==jiechuArray.count-1) {
            [self.navigationController popViewControllerAnimated:YES];
        }else{
            _imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"jiechu%@.PNG",jiechuArray[_curIndex+1]]];
        }
    
    }
    _curIndex+=1;
}
@end
